﻿using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Web;
using System.Xml;

namespace zielonka.co.uk.extensions.system.xml
{
    //Description:	Simply returns the value property from an XmlNode whether it's null or not. Simplifies using XmlDocuments.
    /*
        var xDoc = new XmlDocument();
        xDoc.LoadXml(xml);

        var xmlNode = xDoc.SelectSingleNode("//result/text()");
        string result = xmlNode.GetValue();

        // OR

        string result = xDoc.SelectSingleNode("//result/text()").GetValue();
     */
    public static partial class XMLNodeExtensions
	{
        public static string GetValue(this XmlNode node)
        {
            if (node != null)
                return node.Value;
            else
                return string.Empty;
        }
	}
}
